Обновить

Internet proxy: Internet access, Tor, I2P and other networks via Yggdrasil

Время на прочтение 7 min
Количество просмотров 20K

To access hidden networks like I2P, Tor, Zeronet and others, you must first install the appropriate program. Such a program is a window into a network that is hidden to the outside observer, providing all the internal logic: cryptography, interaction with other nodes, access to the start node, and the like, which the average user does not need to know in order to save a sound sleep.

Once the network client is installed, you need to configure your browser or other software. Most often, software clients of hidden networks provide an HTTP or SOCKS proxy for the end user. These are standard protocols that are supported by all web browsers, many instant messengers and even some games. With the Hidden Network Software Client Proxy, you can route almost any application's traffic to the Hidden Network.

When traveling on the regular Internet, we don’t think about domain zones: ru, com, org, and so on, because they all open the same way. However, setting your browser to open a site on the I2P network will not open the onion domain from the Tor network. To do this, you will need to change the proxy server settings. By tinkering with the configs, you can simplify this task, but if you add the Yggdrasil network here, the topic will become much more complicated. Thus, your browser settings will invariably become more complex, thereby creating a field for potential leaks of requests from your real IP address to dubious resources. And this is provided that programs for access to all named networks must be installed on each of your devices where you want to use them.

In this article, we will look at setting up an internetwork proxy server, which needs to be configured only once and then used from any device, moving from a site on one network to a resource on another hidden network without even thinking about additional browser settings or anything else. Will be used tinyproxy - lightweight HTTP proxy server for Unix-like operating systems. To implement what is shown, any weak Debian-based server will do..

Educational program on safety

To connect to the proxy server we will use Yggdrasil - lightweight transport network with end-to-end encryption. You can think of it like a VPN. This solution is due to the fact that the traffic of hidden networks is transmitted in encrypted form only within the hidden network, and from the local software client that you install on your device to the web browser or other application, the data goes in clear text. It is normal for unencrypted data to be transmitted locally, but transmitting it over the Internet, where many people will monitor passing packets, is extremely undesirable. This is your traffic straight from the darknet.

Regular websites use the HTTPS protocol, which encrypts the transmitted data. Such a solution entails additional settings and weaknesses in the form of centralized certification authorities with all that it implies, so we will do it hardcore, without trusting third parties - on the promising and lightweight Yggdrasil mesh network.

Installation and configuration

We won't waste time demonstrating the installation. Tor, I2P And Yggdrasil. Moreover, the list of hidden networks can be expanded at your discretion. You can easily find the missing background information on installation on the Internet. So, we have a fresh, weak server with installed clients of the Yggdrasil, I2P and Tor networks.

Let's go to tinyproxy git repository. Copy the link for cloning. To clone a repository to the server, you must first install git with the command apt install git (if you are not working as a superuser, add the word to the beginning of the commands sudo).

Execute the command git clone https://github.com/tinyproxy/tinyproxy.git. Instructions for compiling source codes are on the main page of the repository.

On the bare server script autogen.sh fails with error: Toolbox needs to be installed: apt install build-essential autotools-dev automake. Now autogen.sh works correctly. When building a version directly from the repository, after executing autogen.sh let's go straight to the team make, skipping a point ./configure, and then execute make install.

tinyproxy releases on GitHub are also distributed as source code and compiled in a similar way, so there is no big difference between building a release and the current state of the Git repository.

It is already possible to start a proxy server, but all the files are installed in the current directory, and the service file for systemd is completely missing. This is a significant hindrance for an inexperienced user.

The astute reader will probably be indignant: why not just install tinyproxy from the standard Debian repository, because it is there! Why not?.. Let's execute the command apt install tinyproxy. The familiar systemd service immediately appeared in the system (tinyproxy.service), and also the configuration file in /etc/tinyproxy/tinyproxy.conf.

Open the configuration file nano /etc/tinyproxy/tinyproxy.confand indicate the address to which the proxy server will accept user connections. This is done through the "Listen" parameter. Yggdrasil IPv6 address can be easily viewed through the utility ifconfig.

We go further down the configuration file and now the most interesting part: we indicate the upstreams, that is, the addresses of the proxy servers to which certain subnets or domains will be transferred. In our case, this is the i2pd proxy (127.0.0.1:4444) for ".i2p" and Tor domains (127.0.0.1:9050) - for ".onion" domains. For i2pd, I recommend specifying an http proxy, since this mode of operation is more convenient for managing the address book and adding new short i2p addresses directly through the browser. It is also possible to specify the "upstream none" parameter, which is responsible for direct connection of the proxy server to specific addresses and domains, regardless of other rules.

upstream none "200::/7" # Подсеть Yggdrasil Network
upstream http 127.0.0.1:4444 ".i2p"
upstream socks5 127.0.0.1:9050 ".onion"

We go lower in the file and comment out the “Allow” line with the local address, since we will not be connecting from the local machine. If there is no "Allow" value in the configuration file, tinyproxy accepts connections from any addresses.

For comfortable use, you need to comment out all the “ConnectPort” parameters, since there is no need to limit yourself and our users when connecting to non-standard ports.

Save the changes and restart tinyproxy:

Ctrl + S - Save Changes
Ctrl + X - Exit the editor
systemctl restart tinyproxy - Restart tinyproxy

I set an HTTP proxy in the browser settings. Naturally, Yggdrasil must be installed on the host machine. The default port is 8888. Everything seems to be working correctly: checking the IP address showed the address of the server on which tinyproxy was just installed.

I open the proxy server configuration file again and delete the ".onion" domain from the Tor network proxy: upstream socks5 127.0.0.1:9050. This kind of line means that all connections except Yggdrasil (marked as upstream none) and ".i2p" should be routed to Tor. By restarting tinyproxy, you can check the behavior through the browser.

As of 2021, this configuration will not work when installing the old version: access to the Internet still occurs from the server’s IP address. If you remove the Yggdrasil subnet and try again, tinyproxy will finally start working correctly.

Let's return to the topic of using the current version of the software, and not outdated packages from the repositories of my favorite distribution. Starting with version 1.12, tinyproxy will work correctly with IPv6 subnet designations, however, at the time of writing, the latest release is 1.11. It does not know how to correctly perceive IPv6 subnets. There is no need to talk about an older package from the Debian repository.

Let's replace the outdated tinyproxy binary with the new one that we compiled a few minutes ago:

rm /usr/bin/tinyproxy
cp ./src/tinyproxy /usr/bin/

It would seem that everything is fine, but now the service constantly freezes when starting. Let's try to figure out the reason. If you explicitly pass the configuration file to the executable file, we will see the line numbers that tinyproxy complains about.

Opening the configuration file through the editor nano with a flag -l, so that line numbers are displayed, and I comment on problematic lines. These are outdated parameters that the new version of the program does not want to accept. The reason for the freeze is doubtful, but still.

If we try to run tinyproxy, we will see a freeze again. Opening the systemd service file nano /lib/systemd/system/tinyproxy.service and I simplify the launch algorithm a little. Perhaps this is not the most orthodox solution, but if only it would work: I comment out the “EnvironmentFile” parameter and change the “ExecStart” line, explicitly indicating the path to the configuration file.

You need to run the command systemctl daemon-reload, for changes in the service file to take effect. The updated tinyproxy has started.

By the way, tinyproxy has a monitoring web page available by default at http://tinyproxy.stats. Naturally, this page can only be opened through the proxy server itself..

Checking the Yggdrasil address also shows that we are not visiting from our own address, but from the address of the server where tinyproxy is installed. Changing the Yggdrasil address through our proxy now also works. Moreover, you can open any domain from the I2P or Tor networks.

The browser displays the IPv6 address of Yggdrasil, which belongs to the proxy server
The browser displays the IPv6 address of Yggdrasil, which belongs to the proxy server

If you don't need access to an IPv6 network through a proxy server, you can essentially use just the legacy package from your operating system's repository without any additional hassle. Also, someone might consider it a lifehack to pre-install a full-fledged package so that the tinyproxy service file is created, and then update the service file, as was done in the example above. Your server is yours to decide how you will administer it.

At this point, the configuration of the multi-network proxy server can be considered complete. Similar to what is shown, you can add any upstreams for other hidden networks or individual domains and use a single proxy server on all your devices for any applications, without bothering yourself with installing additional software on each device (except Yggdrasil).

The tutorial is deliberately somewhat lengthy to demonstrate a solution to the problem with launching after updating the binary file. I think this will help develop the ingenuity of young administrators.

The article is a text version video.

Tags:
Hubs:
Всего голосов 9: ↑9 и ↓0 +9
Комментарии 15

Comments 15

Build a package from the new version and install it in no way? Why don't you show how to do it??

A kind of answer to “why not just do it?” apt install tinyproxy". Perhaps not the most successful implementation of the answer, but how could I)

I understand correctly that with this .i2p/.onion setup, the site can embed a tracker from the open Internet on the page, and our browser will promptly request it?

Yes, maybe the question of how critical this is in your case is up to you to decide. For example, I would be indifferent to the fact that some left-handed dude gets the ip of my VPN server

Everything must be approached wisely. I usually release all traffic (except I2P and Yggdrasil) through Tor, and if there are additional left proxy servers, I redirect all requests to the clearnet through them. Thus, no request leaves the IP address of the server itself.

There are even more options. Tor Browser comes with a certain window size (which is not recommended to be changed) and other settings for a reason.

That is why there is nothing wrong with accessing filibuster through Tor from a regular browser, but in more serious cases, using a regular browser to access the darknet is a bad idea. And that’s why it’s better not to make such proxies - it relaxes and teaches carelessness (which can result, for example, in prison if your actions on the darknet correspond to).

Undecided on the answer between the options with a joke about the customer of this article, or something constructive)

Yes, I myself once wrote similar instructions (about transparent access to anonymous networks). Exclusively for good purposes, but since then the opinion has changed.

It's like logging into your VPS as root (instead of using sudo as needed). It doesn't seem to be a big deal, but it forms a bad habit..

It would have been possible to bore the article with mentions about security: from JS to exotic fingerprints of the dust layer on the south bridge of the motherboard, but I didn’t. If I ever write such an article, I will add a link here. In general, I think that it is impossible to become a hacker based on one article on Habré and all this is more of a science-fiction for IT students.

I don’t understand this hysteria about working as root on a single-user server, where I only log in for administration..

Let's replace the outdated tinyproxy binary with the new one that we compiled a few minutes ago:

rm /usr/bin/tinyproxy

cp ./src/tinyproxy /usr/bin/

Don't do that! For about the same reason as the comment below + creating a mess in the system. There is a special place for personally collected binaries: /usr/local/bin And then simply rewrite the call path in the service override to /usr/local/bin/tinyproxy Better yet, add a directive Environment="PATH=/usr/local/bin:/usr/sbin:/usr/bin" and remove paths from binary launch directives.

Opening the systemd service file nano /lib/systemd/system/tinyproxy.service and simplify the launch algorithm a little.

For direct editing of a vendor unit, you have to slap your hands with a slide rule! ;-) Overrides, who were they invented for? Team systemctl edit unitnamefor whom? Yes, even the presence of a unit of the same name in /etc/systemd/system completely replaces vendoring. What do you think your unit will turn into when the latest version of the package arrives? Right! The vendor unit that you edited will turn into a pumpkin, being overwritten by the package manager - a file from the latest version of the package!

PS: And yes. Utility ifconfig It’s not available everywhere... And it’s already very bad. In modern distributions, this deprecated utility, for many reasons, is replaced by ip a, A ifconfig must be installed from a separate package. So that's not very good advice either..

PPS: I have an article almost ready, on the same topic, only there, the emphasis is on a slightly different use of tinyproxy and tor.

Thanks for the comment. We are waiting for your article)

Informative article, can you recommend an analogue of tinyproxy for Windows? If possible, a guide for setting up Nginx to perform the tinyproxy function.

3proxy is an analogue that also works on Windows. Its settings look different, but to your delight, the official documentation is in Russian. Nginx is a web server, so I very much doubt that even part of the described proxy server functionality can be achieved from it.

Only full-fledged users can leave comments. Sign in, Please.